/**
 * gpms
 * 2012-8-2 下午5:26:59
 * 作者：陈志明
 * 
 */
package com.gpms.system.action;

import com.gpms.common.action.BaseActionSupport;
import com.gpms.mapper.Users;
import com.gpms.privilege.service.UserService;

/**
 * @author Jackie chen
 *
 */
public class LoginAction extends BaseActionSupport {
	private Users user;
	private UserService userService;
	
	public String login(){
		String result="";
		Users u=userService.getUserByName(user);
		if(u!=null){
			if(u.getPassword().equals(user.getPassword())){
				if(u.getEnable().equals("1")){
					if(u.getOnlinestatus().equals("1")){
						result="frame";
					}else{
						System.out.println("用户已经登录");
						result="login";
					}
				}else{
					System.out.println("用户被锁定");
					result="login";
				}
			}else{
				System.out.println("密码错误！");
				result="login";
			}
		}else{
			System.out.println("用户不存在！");
			result="login";
		}
		return result;
	}

	/**
	 * @return the user
	 */
	public Users getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(Users user) {
		this.user = user;
	}

	/**
	 * @return the userService
	 */
	public UserService getUserService() {
		return userService;
	}

	/**
	 * @param userService the userService to set
	 */
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
}
